<template>
  <div id="app">
    ssssss
    <router-view />
  </div>
</template>

<script>
export default {
  name: "App",
  created() {
    this.initGlobalLoading();
    this.initGlobalTips();

    setTimeout(() => {
      this.$router.push("/login");
    }, 5000);
  },
  methods: {
    initGlobalLoading() {
      let loading = null;
      window.showLoading = () => {
        loading = this.$loading({
          lock: true,
          text: "加载中...",
          spinner: "el-icon-loading",
          background: "rgba(0, 0, 0, 0.1)",
        });
      };
      window.hideLoading = () => {
        if (loading) loading.close();
      };
    },
    initGlobalTips() {
      /*
       * @params type info,success,warning,error
       */
      window.showTips = (message, type = "success") => {
        this.$message({
          type,
          message,
        });
      };
    },
  },
};
</script>
